package top.mingtea.propertymannagement.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.mingtea.propertymannagement.pojo.property_management;
import top.mingtea.propertymannagement.service.property_managementService;

import java.util.List;

@RestController
@RequestMapping("/propertyManagement")
public class property_managementController {
    @Autowired
    private final property_managementService propertyManagementService;

    public property_managementController(property_managementService propertyManagementService) {
        this.propertyManagementService = propertyManagementService;
    }

    @GetMapping("/getlist")
    public List<property_management> getAll() {
        return propertyManagementService.getAll();
    }

    @PostMapping("/add")
    public void add(@RequestBody property_management propertyManagement) {
        propertyManagementService.add(propertyManagement);
    }

    @DeleteMapping("/remove/{id}")
    public void remove(@PathVariable("id") String management_id) {
        propertyManagementService.remove(management_id);
    }

    @PutMapping("/update")
    public void update(@RequestBody property_management propertyManagement) {
        propertyManagementService.update(propertyManagement);
    }

    @GetMapping("/unprocessed")
    public List<property_management> getUnprocessedEvents() {
        return propertyManagementService.getUnprocessedEvents();
    }

    @GetMapping("/processing")
    public List<property_management> getProcessingEvents() {
        return propertyManagementService.getProcessingEvents();
    }

    @GetMapping("/processed")
    public List<property_management> getProcessedEvents() {
        return propertyManagementService.getProcessedEvents();
    }
}
